/*************************************************************************
        > File Name: processBar.c
        > Author: tcy
        > Mail: 2652028905@qq.com
        > Created Time: Thu 23 May 2024 11:16:00 AM +08
 ************************************************************************/
#include <stdio.h>
#include "processBar.h"
#include <unistd.h>
#include <string.h>
#define green "\033[0;32;32m"
#define END "\033[m"
    
char bar[NUM];
char * label = "|/-\\";
void initbar(int rate){
     memset(bar,'\0',sizeof(bar));

}
void processBar(int rate)
{
   if(rate<0||rate>100)return; 
    int len= strlen(label);

    printf(green"[%-100s]"END"[%d%%][%c]\r",bar,rate,label[rate%len]);
    fflush(stdout);
    bar[rate++]=STYLE;
    if(rate<MAX) bar[rate]=BODY;
}
